<include file="Public/head"/>
<body class="no-skin">
<include file="Public/header"/>
<div class="main-container" id="main-container">
    <script type="text/javascript">
        try {
            ace.settings.check('main-container', 'fixed')
        } catch (e) {
        }
    </script>

    <include file="Public/sidebar"/>
    <div class="main-content">
        <div class="main-content-inner">
            <!-- #section:basics/content.breadcrumbs -->
            <include file="Public/breadcrumbs"/>

            <!-- /section:basics/content.breadcrumbs -->
            <div class="page-content">
                <include file="Public/set"/>
				<div class="row">

					<form class="form-inline" action="" style=" padding: 0px 5px; float:left" method="get">

						<label class="inline">提现搜索</label>
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						<label class="inline">供应商家ID</label>
						<input type="text" name="customer_id" value="{$Think.get.customer_id}" class="form-control" size="20">
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						审核状态：
						<div class="form-group">
							<select name="status">    
								<option value="0" <eq name="Think.get.status" value="0">selected</eq>>未审核</option>    
								<option value="1" <eq name="Think.get.status" value="1">selected</eq>>提现失败</option>   
								<option value="2" <eq name="Think.get.status" value="2">selected</eq>>提现成功</option>                         
							</select>
						</div>
						<button type="submit" class="btn btn-purple btn-sm">
							<span class="ace-icon fa fa-search icon-on-right bigger-110"></span>
							Search
						</button>
					</form>
				</div>
				<div class="space-4"></div>
				<div class="row" style="">
					<div class="col-sm-12">
						<div class="infobox infobox-pink">
							<div class="infobox-icon">
								<i class="ace-icon fa fa-shopping-cart"></i>
							</div>

							<div class="infobox-data">
								<span class="infobox-data-number">{$total}</span>
								<div class="infobox-content">提现总数量</div>
							</div>
						</div>
						<div class="infobox infobox-pink">
							<div class="infobox-icon">
								<i class="ace-icon fa fa-shopping-cart"></i>
							</div>

							<div class="infobox-data">
								<span class="infobox-data-number">{$w_total}</span>
								<div class="infobox-content">未审核数量</div>
							</div>
						</div>
						<div class="infobox infobox-pink">
							<div class="infobox-icon">
								<i class="ace-icon fa fa-shopping-cart"></i>
							</div>
							<div class="infobox-data">
								<span class="infobox-data-number">{$s_total}</span>
								<div class="infobox-content">提现失败数量</div>
							</div>
						</div>
						<div class="infobox infobox-pink">
							<div class="infobox-icon">
								<i class="ace-icon fa fa-shopping-cart"></i>
							</div>

							<div class="infobox-data">
								<span class="infobox-data-number">{$c_total}</span>
								<div class="infobox-content">提现成功数量</div>
							</div>
						</div>
						
						<div class="infobox infobox-pink">
							<div class="infobox-icon">
								<i class="ace-icon fa fa-shopping-cart"></i>
							</div>

							<div class="infobox-data">
								<span class="infobox-data-number">{$p_total}</span>
								<div class="infobox-content">共提现金额</div>
							</div>
						</div>
					</div>
				</div>
                <!-- /section:settings.box -->
                <div class="row">
                    <div class="col-xs-12">
                        <!-- PAGE CONTENT BEGINS -->
                        <div class="space-4"></div>
                        <div class="row">
                            <form id="form" method="post" action="{:U('del')}">
                                <table class="table table-striped table-bordered table-hover">
                                    <thead>
                                    <tr>
                                        <th class="center"><input class="check-all" type="checkbox" value=""></th>
                                        <th>提现商家</th>
                                        <th>账户名</th>
                                        <th>账户号</th>
                                        <th>提现金额</th>
                                        <th>商家备注</th>
                                        <th>状态</th>
                                        <th>提现时间</th>
                                        <th class="center">操作</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <style>
                                        .grouptd {
                                            position: relative;
                                        }

                                        .group {
                                            display: inline-block;
                                            width: 100%;
                                        }

                                        .groupselect {
                                            position: absolute;
                                            top: 0;
                                            left: 0;
                                            width: 100%;
                                            height: 100%;
                                            border: 0;
                                        }
                                    </style>
                                    <volist name="list" id="val">
                                        <tr>
                                            <td class="center">
                                                <input class="ids" type="checkbox" name="ids[]" value="{$val['id']}">
                                            </td>
                                            <td>{$val['shop_name']}</td>
                                            <td>{$val['account_name']}</td>
                                            <td>{$val['account_no']}</td>
                                            <td>{$val['money']}</td>
                                            <td>{$val['note']}</td>
                                            <td>{$val['status']}</td>
                                            <td>{:date("Y-m-d H:i:s" , $val['create_time'])}</td>
                                            <td class="center">
                                                <eq name="val.application_status" value="2">--<else/><a href="javascript:;" id="shenhe" data-id="{$val.id}">审核</a></eq>
                                            </td>
                                        </tr>
                                    </volist>
                                    </tbody>
                                </table>
                            </form>
                            <div class="cf">
								<input id="submit_sh" class="btn btn-info" type="button" value="一键提现成功">
							</div>
                            {$page}
                        </div>
                        <!-- PAGE CONTENT ENDS -->
                    </div><!-- /.col -->
                </div><!-- /.row -->
            </div><!-- /.page-content -->
        </div>
    </div><!-- /.main-content -->
	<style>
		.tk_div_info{ width:500px; height:280px; border:1px solid #ccc; position:fixed; background:#fff; top:30%; left:50%; margin-left:-249px; -webkit-box-shadow: #666 0px 0px 10px; -moz-box-shadow: #666 0px 0px 10px; box-shadow: #666 0px 0px 10px;behavior: url(/PIE.htc); display:none;}
		.tk_div_info dl{ margin:20px;display:block; }
		.tk_div_info dl dt{ width:100%; border-bottom:1px dashed #ccc; height:40px; line-height:40px; font-size:16px; margin-bottom:20px;}
		.tk_div_info dl dd{ width:100%; margin-bottom:10px;}
		.tk_div_info dl dd label{ width:120px; display: inline-block; }
		textarea[disabled]{ background:#efefef}
	</style>
	<div class="tk_div_info">
		<dl>
        	<dt>提现信息审核<a href="javascript:;" onclick="$('.tk_div_info').hide();" style=" position:absolute; width:20px; height:20px; line-height:20px; text-align:center; margin:-10px 0px 0px 350px; color:#fff; background:#666; display:inline-block; font-size:16px;">×</a></dt>
            <dd><label>提现状态：</label><select id="shen_status" style="vertical-align:middle"><option value="2">提现成功</option><option value="1">提现失败</option></select></dd>
            <dd><label>提现失败原因：</label><textarea id="note" disabled style="vertical-align:middle; width:220px; height:60px;"></textarea></dd>
            <dd style=" margin-top:20px;"><label>&nbsp;</label><button type="button" style=" padding:8px 20px; border:none; background:#6fb3e0; color:#fff;" id="shenhe_but">确认操作</button></dd>
        </dl>
	</div>
    <include file="Public/footer"/>

</div><!-- /.main-container -->

<include file="Public/footerjs"/>
<!-- inline scripts related to this page -->
<script type="text/javascript">
    $(function () {
        $('a#shenhe').click(function(){
			var _self = $('.tk_div_info');
			_self.find('textarea').val('').attr('disabled' , true);
			_self.find('select option:selected').attr( 'selected' , false );
			_self.find('select option').eq(0).attr( 'selected' , true );
			_self.find('button').attr('data-id' , $(this).attr('data-id'));
			_self.show();
		});
		$('#shen_status').change(function(){
			if( $(this).val() == 1 ) {
				$('.tk_div_info').find('textarea').val('').attr('disabled' , false);
			} else {
				$('.tk_div_info').find('textarea').val('').attr('disabled' , true);	
			}
		});
		$(document).on('click' , '#shenhe_but' , function(){
			var id = $(this).attr('data-id');
			var note = $('#note').val();
			var status = $('#shen_status').val();
			if( status == 1 && note == '' ) {
				swal('请输入提现失败的原因' , '' , 'error');
				return false;	
			}
			$.get('{:U('saveStatus')}' , { id : id , status : status, note:note } , function(data){
				swal( data.info , '' , ( data.status == 1 ? 'success' : 'error' ) );
				setTimeout(function(){ location.reload(); } , 1500);
			},'json');
		});
		$('#submit_sh').click(function(){
			var _self = $('input.ids:checked');
			if( _self.length <= 0 ) {
				swal('请勾选要审核的数据' , '' , 'error');
				return false;
			}
			var ids = '';
			_self.each(function(){ ids+=','+$(this).val(); });
			$.get('{:U('saveStatus')}' , { id : ids.substr(1) , status : 2 } , function(data){
				swal( data.info , '' , ( data.status == 1 ? 'success' : 'error' ) );
				setTimeout(function(){ location.reload(); } , 1500);
			},'json');
		});
		$(".check-all").click(function () {
			$(".ids").prop("checked", this.checked);
		});
    })
</script>
</body>
</html>
